<template>
  <div class="main add-training-plan">
    <van-field
      label="姓名"
      readonly
      v-model="ChnName"
      name="area"
    >
    </van-field>
    <van-field
      label="工号"
      placeholder="无"
      readonly
      class="textarea"
      v-model="WorkCode"
    ></van-field>

    <div style="display:flex;" class="van-cell van-cell--required van-field">
      <div >
      登录账号
      </div>
      <div style="flex:2.5;display:flex;" class="van-cell__value van-field__value">
       <div style="flex:1">
         <span>{{CompanyCode+"_"}}</span>
       </div>
      <div style="flex:1.5" class="van-field__body">
          <input v-model="AccountCode" class="van-field__control">
      </div>
      
      </div>
    </div>
        
    <div class="bottom_submit">
      <van-button type="primary" @click="_submit()"> 保存 </van-button>
    </div>
  </div>
</template>

<script>
import store from "@/store/index";
import { SaveCreateAccount } from "@/api/userUser";
export default {
  data() {
    return {
      UserName: this.$route.query.UserName,
      ChnName: this.$route.query.ChnName,
      WorkCode: this.$route.query.WorkCode,
      CompanyCode: this.$route.query.CompanyCode,
      AccountCode:""
    };
  },

  created() {
  },
  methods: {
    // 保存
    _submit() {
      if (this.$route.query.id > 0) {
      }
      const formData = {
        userName: this.UserName,
        AccountCode: this.AccountCode
      };

      SaveCreateAccount(formData).then((res) => {
        this.$toast("保存成功");
        setTimeout(() => {
          // this.$router.push('/Train')
          this.$router.go(-1);
        }, 500);
      });
    },
    getDetail() {
      let params = { userName: this.data.UserName };
      if (this.data.UserName) {
        getUserDetail(params).then((res) => {
          this.data = res.data;
        });
      }
    },
  },
};
</script>
<style lang="less">
.add-training-plan {
  .textarea {
    .van-field__control {
      background-color: #f8f8f8 !important;
    }
  }
}
</style>
<style lang="less" scoped>
.col-detail {
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .col-del {
    display: flex;
    align-items: center;
    img {
      width: 15px;
      height: 15px;
      margin-right: 5px;
    }
  }
}
.valueclass {
  color: rgb(0, 195, 224);
}
.examine-text {
  font-size: 10px;
  color: #999;
}
.title {
  display: inline-block;
  position: relative;
  color: #646566;
}
.title::before {
  position: absolute;
  left: -0.21333rem;
  color: #c03131;
  font-size: 0.37333rem;
  z-index: 999;
  content: "*";
}
.bottom_submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
  .van-button {
    width: 100%;
    height: 35px;
  }
}
</style>
